﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FTBS.Models.DAO;
using FTBS.Models.Entities;
using FTBS.Models.Entities.Concert;

namespace FTBS.Models.BLO
{
    public class ShowTimeBLO
    {
        private ShowTimeDAO _showtimeDao = new ShowTimeDAO();

        /// <summary>
        /// Get SelectList room by theaterId -> This function is used to load selectlist to combobox
        /// </summary>
        /// <param name="theaterId">TheaterId</param>
        /// <returns>List of room</returns>
        /// <author>vuongvt</author>
        public SelectList GetSelectListShowTimeByTheater(int theaterId)
        {
            return _showtimeDao.GetSelectListShowTimeByTheater(theaterId);
        }

        /// <summary>
        /// Get all showtime information
        /// </summary>
        /// <returns></returns>
        public List<ShowTimeConcertEntity> GetAllShowTime()
        {
            return _showtimeDao.GetAllShowTime();
        }

        /// <summary>
        /// Get list showtime by theaterId
        /// </summary>
        /// <param name="theaterId"></param>
        /// <returns></returns>
        public List<ShowTime> GetListShowTimeByTheaterId(int theaterId)
        {
            return _showtimeDao.GetListShowTimeByTheaterId(theaterId);
        }

        /// <summary>
        /// Get a Showtime by ShowTimeId
        /// </summary>
        /// <param name="showtimeId"></param>
        /// <returns></returns>
        public ShowTime GetShowTimeById(int showtimeId)
        {
            return _showtimeDao.GetShowTimeById(showtimeId);
        }

        /// <summary>
        /// Add new ShowTime
        /// </summary>
        /// <param name="showtime"></param>
        /// <returns></returns>
        public int CreateShowTime(ShowTime showtime)
        {
            return _showtimeDao.CreateShowTime(showtime);
        }

        /// <summary>
        /// Delete a showtime
        /// </summary>
        /// <param name="showtime"></param>
        /// <returns></returns>
        public int DeleteShowTime(ShowTime showtime)
        {
            return _showtimeDao.DeleteShowTime(showtime);
        }

        /// <summary>
        /// Edit a showtime
        /// </summary>
        /// <param name="showtime"></param>
        /// <returns></returns>
        public int EditShowTime(ShowTime showtime)
        {
            return _showtimeDao.EditShowTime(showtime);
        }

        /// <summary>
        /// List hours
        /// </summary>
        /// <returns></returns>
        /// <author>vuongvt</author>
        public List<string> ListHours()
        {
            List<string> listHours = new List<string>();
            for (int i = 0; i < 24; i++)
            {
                listHours.Add(i.ToString());
            }
            return listHours;
        }

        /// <summary>
        /// List minutes
        /// </summary>
        /// <returns></returns>
        /// <author>vuongvt</author>
        public List<string> ListMinutes()
        {
            List<string> listMinutes = new List<string>();
            for (int i = 0; i < 61; i++)
            {
                if (i < 10)
                {
                    listMinutes.Add("0" + i.ToString());
                }
                else
                {
                    listMinutes.Add(i.ToString());
                }
            }
            return listMinutes;
        }
    }
}